package org.wevil.repo;

import org.wevil.entity.cond.CondRoleMenu;
import org.wevil.entity.pk.PKCondRoleMenu;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CondRoleMenuRepo extends BaseRepo<CondRoleMenu, PKCondRoleMenu> {

    @Query(value = "select menu_id from cond_role_menu where role_id = ?1", nativeQuery = true)
    List<Integer> findMenuIdByRoleId(int roleId);

    @Modifying
    void deleteByRoleId(int roleId);

    @Modifying
    void deleteByMenuId(int menuId);

    @Modifying
    void deleteByMenuIdIn(List<Integer> menuIds);
}
